<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>

    <!-- start: Meta -->
    <meta charset="utf-8">
    <title>Bootstrap Metro Dashboard by Dennis Ji for ARM demo</title>
    <meta name="description" content="Bootstrap Metro Dashboard">
    <meta name="author" content="Dennis Ji">
    <meta name="keyword" content="Metro, Metro UI, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <!-- end: Meta -->

    <!-- start: Mobile Specific -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- end: Mobile Specific -->

    <!-- start: CSS -->
    
    <link id="bootstrap-style" href="/tp/Public/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/tp/Public/admin/css/bootstrap-responsive.min.css" rel="stylesheet">
    <link id="base-style" href="/tp/Public/admin/css/style.css" rel="stylesheet">
    <link id="base-style-responsive" href="/tp/Public/admin/css/style-responsive.css" rel="stylesheet">
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css'>
    <!-- end: CSS -->


    <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <link id="ie-style" href="/tp/Public/admin/css/ie.css" rel="stylesheet">
    <![endif]-->

    <!--[if IE 9]>
        <link id="ie9style" href="/tp/Public/admin/css/ie9.css" rel="stylesheet">
    <![endif]-->

    <!-- start: Favicon -->
    <link rel="shortcut icon" href="/tp/Public/admin/img/favicon.ico">
    <!-- end: Favicon -->




</head>

<body>
        <!-- start: Header -->
    <div class="navbar">
        <div class="navbar-inner">
            <div class="container-fluid">
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".top-nav.nav-collapse,.sidebar-nav.nav-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <a class="brand" href="index.html"><span>JANUX</span></a>

                <!-- start: Header Menu -->
                <div class="nav-no-collapse header-nav">
                    <ul class="nav pull-right">
                        <li class="dropdown hidden-phone">
                            <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="icon-bell"></i>
                                <span class="badge red">
                                7 </span>
                            </a>
                            <ul class="dropdown-menu notifications">
                                <li class="dropdown-menu-title">
                                    <span>You have 11 notifications</span>
                                    <a href="#refresh"><i class="icon-repeat"></i></a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon blue"><i class="icon-user"></i></span>
                                        <span class="message">New user registration</span>
                                        <span class="time">1 min</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon green"><i class="icon-comment-alt"></i></span>
                                        <span class="message">New comment</span>
                                        <span class="time">7 min</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon green"><i class="icon-comment-alt"></i></span>
                                        <span class="message">New comment</span>
                                        <span class="time">8 min</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon green"><i class="icon-comment-alt"></i></span>
                                        <span class="message">New comment</span>
                                        <span class="time">16 min</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon blue"><i class="icon-user"></i></span>
                                        <span class="message">New user registration</span>
                                        <span class="time">36 min</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon yellow"><i class="icon-shopping-cart"></i></span>
                                        <span class="message">2 items sold</span>
                                        <span class="time">1 hour</span>
                                    </a>
                                </li>
                                <li class="warning">
                                    <a href="#">
                                        <span class="icon red"><i class="icon-user"></i></span>
                                        <span class="message">User deleted account</span>
                                        <span class="time">2 hour</span>
                                    </a>
                                </li>
                                <li class="warning">
                                    <a href="#">
                                        <span class="icon red"><i class="icon-shopping-cart"></i></span>
                                        <span class="message">New comment</span>
                                        <span class="time">6 hour</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon green"><i class="icon-comment-alt"></i></span>
                                        <span class="message">New comment</span>
                                        <span class="time">yesterday</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="icon blue"><i class="icon-user"></i></span>
                                        <span class="message">New user registration</span>
                                        <span class="time">yesterday</span>
                                    </a>
                                </li>
                                <li class="dropdown-menu-sub-footer">
                                    <a>View all notifications</a>
                                </li>
                            </ul>
                        </li>
                        <!-- start: Notifications Dropdown -->
                        <li class="dropdown hidden-phone">
                            <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="icon-calendar"></i>
                                <span class="badge red">
                                5 </span>
                            </a>
                            <ul class="dropdown-menu tasks">
                                <li class="dropdown-menu-title">
                                    <span>You have 17 tasks in progress</span>
                                    <a href="#refresh"><i class="icon-repeat"></i></a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="header">
                                            <span class="title">iOS Development</span>
                                            <span class="percent"></span>
                                        </span>
                                        <div class="taskProgress progressSlim red">80</div>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="header">
                                            <span class="title">Android Development</span>
                                            <span class="percent"></span>
                                        </span>
                                        <div class="taskProgress progressSlim green">47</div>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="header">
                                            <span class="title">ARM Development</span>
                                            <span class="percent"></span>
                                        </span>
                                        <div class="taskProgress progressSlim yellow">32</div>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="header">
                                            <span class="title">ARM Development</span>
                                            <span class="percent"></span>
                                        </span>
                                        <div class="taskProgress progressSlim greenLight">63</div>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="header">
                                            <span class="title">ARM Development</span>
                                            <span class="percent"></span>
                                        </span>
                                        <div class="taskProgress progressSlim orange">80</div>
                                    </a>
                                </li>
                                <li>
                                    <a class="dropdown-menu-sub-footer">View all tasks</a>
                                </li>
                            </ul>
                        </li>
                        <!-- end: Notifications Dropdown -->
                        <!-- start: Message Dropdown -->
                        <li class="dropdown hidden-phone">
                            <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="icon-envelope"></i>
                                <span class="badge red">
                                4 </span>
                            </a>
                            <ul class="dropdown-menu messages">
                                <li class="dropdown-menu-title">
                                    <span>You have 9 messages</span>
                                    <a href="#refresh"><i class="icon-repeat"></i></a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="avatar"><img src="/tp/Public/admin/img/avatar.jpg" alt="Avatar"></span>
                                        <span class="header">
                                            <span class="from">
                                                Dennis Ji
                                             </span>
                                            <span class="time">
                                                6 min
                                            </span>
                                        </span>
                                        <span class="message">
                                            Lorem ipsum dolor sit amet consectetur adipiscing elit, et al commore
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="avatar"><img src="/tp/Public/admin/img/avatar.jpg" alt="Avatar"></span>
                                        <span class="header">
                                            <span class="from">
                                                Dennis Ji
                                             </span>
                                            <span class="time">
                                                56 min
                                            </span>
                                        </span>
                                        <span class="message">
                                            Lorem ipsum dolor sit amet consectetur adipiscing elit, et al commore
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="avatar"><img src="/tp/Public/admin/img/avatar.jpg" alt="Avatar"></span>
                                        <span class="header">
                                            <span class="from">
                                                Dennis Ji
                                             </span>
                                            <span class="time">
                                                3 hours
                                            </span>
                                        </span>
                                        <span class="message">
                                            Lorem ipsum dolor sit amet consectetur adipiscing elit, et al commore
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="avatar"><img src="/tp/Public/admin/img/avatar.jpg" alt="Avatar"></span>
                                        <span class="header">
                                            <span class="from">
                                                Dennis Ji
                                             </span>
                                            <span class="time">
                                                yesterday
                                            </span>
                                        </span>
                                        <span class="message">
                                            Lorem ipsum dolor sit amet consectetur adipiscing elit, et al commore
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <span class="avatar"><img src="/tp/Public/admin/img/avatar.jpg" alt="Avatar"></span>
                                        <span class="header">
                                            <span class="from">
                                                Dennis Ji
                                             </span>
                                            <span class="time">
                                                Jul 25, 2012
                                            </span>
                                        </span>
                                        <span class="message">
                                            Lorem ipsum dolor sit amet consectetur adipiscing elit, et al commore
                                        </span>
                                    </a>
                                </li>
                                <li>
                                    <a class="dropdown-menu-sub-footer">View all messages</a>
                                </li>
                            </ul>
                        </li>

                        <!-- start: User Dropdown -->
                        <li class="dropdown">
                            <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="halflings-icon white user"></i> <?php echo ($_SESSION['admin']['username']); ?>
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li class="dropdown-menu-title">
                                    <span>Account Settings</span>
                                </li>
                                <li><a href="#"><i class="halflings-icon user"></i> Profile</a></li>
                                <li><a href="<?php echo U('Admin/admin/loginout');?>"><i class="halflings-icon off"></i> 注销</a></li>
                            </ul>
                        </li>
                        <!-- end: User Dropdown -->
                    </ul>
                </div>
                <!-- end: Header Menu -->

            </div>
        </div>
    </div>
    <!-- start: Header --><div class="copyrights">Collect from <a href="http://www.cssmoban.com/" >企业网站模板</a></div>

        <div class="container-fluid-full">
        <div class="row-fluid">

            <!-- start: Main Menu -->
            <div id="sidebar-left" class="span2">
                <div class="nav-collapse sidebar-nav">
                    <ul class="nav nav-tabs nav-stacked main-menu">

                    <?php if(is_array($laynav)): foreach($laynav as $key=>$v): ?><li>
                            <a class="dropmenu" href="#"><i class="<?php echo ($v["icon"]); ?> white"></i><span class="hidden-tablet"> <?php echo ($v["name"]); ?></span></a>
                            <ul>
                                <?php if(is_array($child_laynav)): foreach($child_laynav as $key=>$vc): ?><!-- <?php if(in_array($v['id'],$_SESSION['admin']['group_access'])){ ?> -->
                                <!-- <?php } ?> -->
                                                    <?php if($v['id'] == $vc['pid']): ?><li><a class="submenu" href="<?php echo U($vc['url']);?>"><i class="<?php echo ($vc["icon"]); ?> white"></i><span class="hidden-tablet"><?php echo ($vc["name"]); ?></span></a></li><?php endif; endforeach; endif; ?>
                            </ul>
                        </li><?php endforeach; endif; ?>

                    </ul>
                </div>
            </div>
            <!-- end: Main Menu -->

            <noscript>
                <div class="alert alert-block span10">
                    <h4 class="alert-heading">Warning!</h4>
                    <p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a> enabled to use this site.</p>
                </div>
            </noscript>






    


            <!-- start: Content -->
            <div id="content" class="span10">


            <ul class="breadcrumb">
                <li>
                    <i class="icon-home"></i>
                    <a href="index.html">后台</a>
                    <i class="icon-angle-right"></i>
                </li>
                <li>
                    <i class="icon-edit"></i>
                    <a href="#">商品添加</a>
                </li>
            </ul>

            <div class="row-fluid sortable">
                <div class="box span12">
                    <div class="box-header" data-original-title>
                        <h2><i class="halflings-icon white edit"></i><span class="break"></span>商品添加</h2>
                        <div class="box-icon">
                            <a href="#" class="btn-setting"><i class="halflings-icon white wrench"></i></a>
                            <a href="#" class="btn-minimize"><i class="halflings-icon white chevron-up"></i></a>
                            <a href="#" class="btn-close"><i class="halflings-icon white remove"></i></a>
                        </div>
                    </div>
                    <div class="box-content">
                        <form class="form-horizontal" enctype="multipart/form-data" id="signupfrom" method="post" action="">
                          <fieldset>
                            <div class="control-group">
                              <label class="control-label" for="typeahead">商品名称 </label>
                              <div class="controls">
                                <input type="text" id="b_name" name="goods_name" class="span2 typeahead"   data-provide="typeahead" data-items="4" >
                                <span></span>
                              </div>
                            </div>
                            <div class="control-group">
                              <label class="control-label" for="typeahead">商品编号 </label>
                              <div class="controls">
                                <input type="text" disabled="disabled" id="goods_no" name="goods_no" class="span2 typeahead"   data-provide="typeahead" data-items="4" >
                                <span></span>
                              </div>
                            </div>
                            <div class="control-group">
                              <label class="control-label" for="fileInput">图片上传</label>
                              <div class="controls">
                              <input class="input-file uniform_on" name="img" id="fileInput" type="file">
                              </div>
                            </div>
                            <div class="control-group">
                              <label class="control-label" for="typeahead">市场价 </label>
                              <div class="controls">
                                <input type="text" id="b_name" name="marke_price" class="span2 typeahead"   data-provide="typeahead" data-items="4" >
                                <span></span>
                              </div>
                            </div>
                            <div class="control-group">
                              <label class="control-label" for="typeahead">本店价 </label>
                              <div class="controls">
                                <input type="text" id="b_name" name="shop_price" class="span2 typeahead"   data-provide="typeahead" data-items="4" >
                                <span></span>
                              </div>
                            </div>
                              <div class="control-group">
                                <label class="control-label"  for="selectError3">分类</label>
                                <div class="controls">
                                  <select name="cate_id" id="selectError3">
                                  <option value="0">请选择分类类型</option>
                                    <?php if(is_array($cate_list)): foreach($cate_list as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
                                  </select>
                                </div>
                              </div>
                              <div class="control-group">
                                <label class="control-label"  for="selectError3">品牌</label>
                                <div class="controls">
                                  <select name="brand_id" id="selectError3">
                                  <option value="0">请选择品牌类型</option>
                                    <?php if(is_array($brand_list)): foreach($brand_list as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
                                  </select>
                                </div>
                              </div>
                              <div class="control-group">
                                <label class="control-label"  for="selectError3">商品类型</label>
                                <div class="controls">
                                  <select name="pid" id="selectError3" class="spec_item">
                                  <option value="0">请选择商品类型</option>
                                    <?php if(is_array($goods_type)): foreach($goods_type as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
                                  </select>
                                </div>
                              </div>
                              <div class="control-group">
                                <label class="control-label">上架</label>
                                <div class="controls">
                                  <label class="radio">
                                    <input type="radio" name="is_down" value="1" id="optionsRadios1"  checked="">
                                    是
                                  </label>
                                  <label class="radio">
                                    <input type="radio" name="is_down" value="0" id="optionsRadios2" >
                                    否
                                  </label>
                                </div>
                              </div>
                              <div class="control-group">
                                <label class="control-label">新品</label>
                                <div class="controls">
                                  <label class="radio">
                                    <input type="radio" name="is_new" value="1" id="optionsRadios1"  checked="">
                                    是
                                  </label>
                                  <label class="radio">
                                    <input type="radio" name="is_new" value="0" id="optionsRadios2" >
                                    否
                                  </label>
                                </div>
                              </div>
                              <div class="control-group">
                                <label class="control-label">热销</label>
                                <div class="controls">
                                  <label class="radio">
                                    <input type="radio" name="is_hot" value="1" id="optionsRadios1"  checked="">
                                    是
                                  </label>
                                  <label class="radio">
                                    <input type="radio" name="is_hot" value="0" id="optionsRadios2" >
                                    否
                                  </label>
                                </div>
                              </div>
                              <div class="control-group" >
                              <label class="control-label">商品规格项</label>
                              </div>
                               <div id="item_sel">
                               <!--<?php if(is_array($spec_list)): foreach($spec_list as $k=>$v): ?><div class="control-group" >
                                 <label class="control-label"><?php echo ($v["spec_name"]); ?></label>
                                  <?php if(is_array($spec_item_list)): foreach($spec_item_list as $ks=>$vs): if($v['id'] == $vs['spec_id']): ?><div class="box black span2" onTablet="span6" onDesktop="span4">
                                    <div class="box-header">
                                      <h2><?php echo ($vs["name"]); ?></h2>
                                      <div class="box-icon">
                                        <a href="#" class="btn-minimize"><i class="halflings-icon white chevron-down" fled="0"></i></a>
                                      </div>
                                    </div>
                                    <div class="box-content" style="display: none;">
                                      <ul class="dashboard-list metro">
                                        <li>
                                          <input type="text" name="spec_item_id" value="" class="span12 spec_inp">
                                        </li>
                                      </ul>
                                    </div>
                                  </div><?php endif; endforeach; endif; ?>

                                </div><?php endforeach; endif; ?>
                                <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>-->
                              </div>
                              <div class="control-group" style="margin-left:170px" >
                                <button type="button" id="button" class="btn btn-primary">规格录入</button>
                              </div>
                              <div class="control-group" id="item_tab" style="margin-left:175px" >
                                <!-- <div class="box-content">
                                  <table class="table table-striped table-bordered bootstrap-datatable ">
                                    <thead>
                                        <tr>
                                            <th>id</th>
                                            <th>名称</th>
                                            <th>状态</th>
                                            <th>权限</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                      <tr>
                                          <td></td>
                                          <td></td>
                                          <td></td>
                                          <td></td>
                                          <td class="center">
                                              <a class="btn btn-danger" href="#">
                                                  <i class="halflings-icon white trash"></i>
                                              </a>
                                          </td>
                                      </tr>
                                    </tbody>
                                  </table>
                                </div> -->
                              </div>
                              <div class="control-group" style="margin-left:175px ;" >
                               <script id="editor" name="desc" type="text/plain" style="width:1024px;height:500px;"></script>
                               </div>
                            <div class="form-actions">
                              <button type="submit" class="btn btn-primary">保存</button>
                              <button type="reset" class="btn">清空</button>
                            </div>
                          </fieldset>
                        </form>

                    </div>
                </div><!--/span-->

            </div><!--/row-->
            <div class="row-fluid">
      </div>




    </div><!--/.fluid-container-->

            <!-- end: Content -->

        </div><!--/#content.span10-->
        </div><!--/fluid-row-->

    <div class="modal hide fade" id="myModal">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">×</button>
            <h3>Settings</h3>
        </div>
        <div class="modal-body">
            <p>Here settings can be configured...</p>
        </div>
        <div class="modal-footer">
            <a href="#" class="btn" data-dismiss="modal">Close</a>
            <a href="#" class="btn btn-primary">Save changes</a>
        </div>
    </div>

    <div class="common-modal modal fade" id="common-Modal1" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-content">
            <ul class="list-inline item-details">
                <li><a href="#">Admin templates</a></li>
                <li><a href="http://themescloud.org">Bootstrap themes</a></li>
            </ul>
        </div>
    </div>

    <div class="clearfix"></div>

    <footer>

        <p>
            <span style="text-align:left;float:left">&copy; 2013 <a href="downloads/janux-free-responsive-admin-dashboard-template/" alt="Bootstrap_Metro_Dashboard">JANUX Responsive Dashboard</a></span>

        </p>

    </footer>

    <!-- start: JavaScript-->
    <script src="/tp/Public/admin/js/jquery-1.9.1.min.js"></script>
    
    <script type="text/javascript" charset="utf-8" src="/tp/Public/admin/edit/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/tp/Public/admin/edit/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/tp/Public/admin/edit/lang/zh-cn/zh-cn.js"></script>
    <script src="/tp/Public/admin/js/jquery.validate.min.js"></script>
    <script type="text/javascript">

      //实例化编辑器
      //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
      var ue = UE.getEditor('editor');


      function isFocus(e){
          alert(UE.getEditor('editor').isFocus());
          UE.dom.domUtils.preventDefault(e)
      }
      function setblur(e){
          UE.getEditor('editor').blur();
          UE.dom.domUtils.preventDefault(e)
      }
      function insertHtml() {
          var value = prompt('插入html代码', '');
          UE.getEditor('editor').execCommand('insertHtml', value)
      }
      function createEditor() {
          enableBtn();
          UE.getEditor('editor');
      }
      function getAllHtml() {
          alert(UE.getEditor('editor').getAllHtml())
      }
      function getContent() {
          var arr = [];
          arr.push("使用editor.getContent()方法可以获得编辑器的内容");
          arr.push("内容为：");
          arr.push(UE.getEditor('editor').getContent());
          alert(arr.join("\n"));
      }
      function getPlainTxt() {
          var arr = [];
          arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
          arr.push("内容为：");
          arr.push(UE.getEditor('editor').getPlainTxt());
          alert(arr.join('\n'))
      }
      function setContent(isAppendTo) {
          var arr = [];
          arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
          UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
          alert(arr.join("\n"));
      }
      function setDisabled() {
          UE.getEditor('editor').setDisabled('fullscreen');
          disableBtn("enable");
      }

      function setEnabled() {
          UE.getEditor('editor').setEnabled();
          enableBtn();
      }

      function getText() {
          //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
          var range = UE.getEditor('editor').selection.getRange();
          range.select();
          var txt = UE.getEditor('editor').selection.getText();
          alert(txt)
      }

      function getContentTxt() {
          var arr = [];
          arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
          arr.push("编辑器的纯文本内容为：");
          arr.push(UE.getEditor('editor').getContentTxt());
          alert(arr.join("\n"));
      }
      function hasContent() {
          var arr = [];
          arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
          arr.push("判断结果为：");
          arr.push(UE.getEditor('editor').hasContents());
          alert(arr.join("\n"));
      }
      function setFocus() {
          UE.getEditor('editor').focus();
      }
      function deleteEditor() {
          disableBtn();
          UE.getEditor('editor').destroy();
      }
      function disableBtn(str) {
          var div = document.getElementById('btns');
          var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
          for (var i = 0, btn; btn = btns[i++];) {
              if (btn.id == str) {
                  UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
              } else {
                  btn.setAttribute("disabled", "true");
              }
          }
      }
      function enableBtn() {
          var div = document.getElementById('btns');
          var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
          for (var i = 0, btn; btn = btns[i++];) {
              UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
          }
      }

      function getLocalData () {
          alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
      }

      function clearLocalData () {
          UE.getEditor('editor').execCommand( "clearlocaldata" );
          alert("已清空草稿箱")
      }
    </script>
    <script type="text/javascript">
      $(function(){
        $('#button').click(function(event) {
          //抓取价格
          var _total_price=0;//规格总价格
          var _spec_desc='';//规格描述
          var _stock=0;//库存数量
          var _spec_id='';//规格规则id
          var spec_len=$('.spec').length;//获取完整规格数
          _stock=parseInt($('.stock').val());
          var price= $('.spec input[fled="1"]');
          if(isNaN(_stock)){
            alert('请输入正确的库存数量');
            return false;
          }
          if(spec_len!=price.length || _stock<=0){
            alert('请将录入信息填写完整');
            return false;
          }
          price.each(function(i,obj){
              _total_price+=parseInt($(obj).val());//规格价格
              _spec_desc+=$(obj).attr('spec-name')+'；';//规格描述
              _spec_id+='_'+$(obj).attr('spec-id');//规格规则
          })
           $.ajax({
            type:'post',
            url:'<?php echo U("Admin/ajax/append_spec");?>',
            data:{
              'spec_price':_total_price,
              'spec_desc':_spec_desc,
              'num':_stock,
              'spec_rule':_spec_id
            },
            dataType:'json',
            success:function(e){
              var html='';
              html+='<div class="box-content">';
              html+='<table class="table table-striped table-bordered bootstrap-datatable ">';
              html+='<thead>';
              html+='<tr>';
              html+='<th>规格规则id</th>';
              html+='<th>规格总价</th>';
              html+='<th>库存</th>';
              html+='<th>规格描述</th>';
              html+='<th>操作</th>';
              html+='</tr>';
              html+='</thead>';
              html+='<tbody>';
              for(i in e){
                html+='<tr>';
                html+='<td>'+e[i].spec_rule+'</td>';
                html+='<td>'+e[i].spec_price+'</td>';
                html+='<td>'+e[i].num+'</td>';
                html+='<td>'+e[i].spec_desc+'</td>';
                html+='<td class="center">';
                html+='<a class="btn btn-danger" href="#">';
                html+='<i class="halflings-icon white trash"></i>';
                html+='</a>';
                html+='</td>';
                html+='</tr>';
              }
              html+='</tbody>';
              html+='</table>';
              html+='</div>';
              $('#item_tab').html(html);
            },
          });
        });
        $('.spec_item').change(function(){

          var id=$(this).val();
          $('#item_sel').css({"display":"block" });
          $.ajax({
            type:'get',
            url:'<?php echo U("Admin/ajax/getSpec");?>',
            data:{
              'id':id,
            },
            dataType:'json',
            success:function(e){
              var html='';
              for(i in e){
                html+='<div class="control-group spec" style="margin-left:50px" >';
                html+='<label class="control-label">'+e[i].spec_name+'</label>';

                for(j in e[i]['spec_item']){
                  if(e[i]['id'] == e[i]['spec_item'][j]['spec_id']){
                    html+='<div class="box black span2" onTablet="span6" onDesktop="span4">';
                    html+='<div class="box-header">';
                    html+='<h2>'+e[i]['spec_item'][j]['name']+'</h2>';
                    html+='<div class="box-icon">';
                    html+='<a  class="btn-minimize"><i class="halflings-icon white chevron-down" fled="0"></i></a>';
                    html+='</div>';
                    html+='</div>';
                    html+='<div class="box-content" style="display: none;">';
                    html+='<ul class="dashboard-list metro">';
                    html+='<li>';
                    var desc=e[i].spec_name+'：'+e[i]['spec_item'][j]['name'];
                    html+='<input type="text" name="price" spec-id='+e[i]['spec_item'][j]['id']+' spec-name="'+desc+'" fled="0" value="" class="span12 spec_inp">';
                    html+='</li>';
                    html+='</ul>';
                    html+='</div>';
                    html+='</div>';
                  }
                }
                html+='</div>';

              }
                    html+='<div class="control-group" style="margin-left:50px">';
                    html+='<label class="control-label" for="typeahead">库存 </label>';
                    html+='<div class="controls">';
                    html+='<input style="margin-left:20px" type="text" id="stock" name="stock" class="span2 typeahead stock"   data-provide="typeahead" data-items="4" placeholder="请输入规格库存" >';
                    html+='<span></span>';
                    html+='</div>';
                    html+='</div>';
              $('#item_sel').html(html);
              $('.halflings-icon').click(function(event) {

                var a=$(this).attr('fled');
                if(a==0){

                  $(this).attr('fled','1');
                  $(this).parent().parent().parent().parent().find('input').attr('fled','1');
                  $(this).parent().parent().parent().parent().find('.box-content').css({"display":"block" });
                  $(this).parent().parent().parent().parent().siblings().find('input').attr('fled','0');
                  $(this).parent().parent().parent().parent().siblings().find('i').removeClass('chevron-up');
                  $(this).parent().parent().parent().parent().siblings().find('.box-content').css({"display":"none" });
                  $(this).parent().parent().parent().parent().siblings().find('input').val('');
                  $(this).parent().parent().parent().parent().siblings().find('i').addClass('chevron-down');
                  $(this).parent().parent().parent().parent().siblings().find('i').attr('fled','0');
                }else{
                  $(this).parent().parent().parent().parent().find('input').attr('fled','0');
                  $(this).parent().parent().parent().parent().find('.box-content').css({"display":"none" });
                  $(this).attr('fled','0');
                }
              });
              },
          })
        })

        // $('#item_sel').on('click','.halflings-icon',function(event) {

        //   var a=$(this).attr('fled');
        //   if(a==0){

        //     $(this).attr('fled','1');
        //     $(this).parent().parent().parent().parent().find('input').attr('fled','1');
        //     $(this).parent().parent().parent().parent().find('.box-content').css({"display":"block" });
        //     $(this).parent().parent().parent().parent().siblings().find('input').attr('fled','0');
        //     $(this).parent().parent().parent().parent().siblings().find('i').removeClass('chevron-up');
        //     $(this).parent().parent().parent().parent().siblings().find('.box-content').css({"display":"none" });
        //     $(this).parent().parent().parent().parent().siblings().find('input').val('');
        //     $(this).parent().parent().parent().parent().siblings().find('i').addClass('chevron-down');
        //     $(this).parent().parent().parent().parent().siblings().find('i').attr('fled','0');
        //   }else{
        //     $(this).parent().parent().parent().parent().find('input').attr('fled','0');
        //     $(this).parent().parent().parent().parent().find('.box-content').css({"display":"none" });
        //     $(this).attr('fled','0');
        //   }
        // });
      })
    </script>


    <script src="/tp/Public/admin/js/jquery-migrate-1.0.0.min.js"></script>

        <script src="/tp/Public/admin/js/jquery-ui-1.10.0.custom.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.ui.touch-punch.js"></script>

        <script src="/tp/Public/admin/js/modernizr.js"></script>

        <script src="/tp/Public/admin/js/bootstrap.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.cookie.js"></script>

        <script src='/tp/Public/admin/js/fullcalendar.min.js'></script>

        <script src='/tp/Public/admin/js/jquery.dataTables.min.js'></script>

        <script src="/tp/Public/admin/js/excanvas.js"></script>
    <script src="/tp/Public/admin/js/jquery.flot.js"></script>
    <script src="/tp/Public/admin/js/jquery.flot.pie.js"></script>
    <script src="/tp/Public/admin/js/jquery.flot.stack.js"></script>
    <script src="/tp/Public/admin/js/jquery.flot.resize.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.chosen.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.uniform.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.cleditor.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.noty.js"></script>

        <script src="/tp/Public/admin/js/jquery.elfinder.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.raty.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.iphone.toggle.js"></script>

        <script src="/tp/Public/admin/js/jquery.uploadify-3.1.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.gritter.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.imagesloaded.js"></script>

        <script src="/tp/Public/admin/js/jquery.masonry.min.js"></script>

        <script src="/tp/Public/admin/js/jquery.knob.modified.js"></script>

        <script src="/tp/Public/admin/js/jquery.sparkline.min.js"></script>

        <script src="/tp/Public/admin/js/counter.js"></script>

        <script src="/tp/Public/admin/js/retina.js"></script>

        <script src="/tp/Public/admin/js/custom.js"></script>
    <!-- end: JavaScript-->

</body>
</html>